import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.sql.Date;
import java.util.ArrayList;

import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextPane;

import com.mysql.jdbc.ResultSet;

/**
 * This class is the check receive assignment UI
 */
public class CheckSubUI extends JPanel {
 	
	/**
	 * title for the current panel  
	 */
 	private JLabel checkAssnTitle = null;
	/**
	 * grade label 
	 */
 	private JLabel lblGrade = null;
	/**
	 * Comennt label 
	 */
 	private JLabel lblComennt = null;
	/**
	 * textComennt TextPane 
	 */
 	private JTextPane textComennt = null;
	/**
	 * back button 
	 */
 	public JButton btnBack = null;
	/**
	 * help button 
	 */
 	public JButton btnHelp = null;
	/**
	 * save the current panel for the "back" function 
	 */
 	private JPanel curPanel;
	/**
	 * logout button 
	 */
 	public JButton btnLogout = null;
 	private Sub submit;
 	
	public CheckSubUI(Sub sub) {
		  super();
		  submit = (Sub) sub;
		  initialize();
	}

	private void initialize() {
		curPanel = this;
		
		this.setSize(400, 321);
		this.setLayout(null);
		
		
		checkAssnTitle = new JLabel("Recieve Checked Assignment");
		checkAssnTitle.setBounds(139, 43, 180, 14);
		this.add(checkAssnTitle);
		
		lblGrade = new JLabel("Grade:       "+submit.getGrade().toString());
		lblGrade.setBounds(92, 80, 180, 14);
		this.add(lblGrade);
		
		lblComennt = new JLabel("Comment: ");
		lblComennt.setBounds(92, 105, 180, 14);
		this.add(lblComennt);
		
		textComennt = new JTextPane();
		textComennt.setText(submit.getComment());
		textComennt.setBounds(150, 105, 154, 107);
		this.add(textComennt);
		
		btnBack = new JButton("Back");
		btnBack.setBounds(187, 253, 86, 25);
		this.add(btnBack,null);
		this.setVisible(true);
		
		btnLogout = new JButton("Logout");        //Logout button
		btnLogout.setBounds(10, 11, 80, 19);
		add(btnLogout);
		btnLogout.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				  LogoutWin logt = new LogoutWin();
				  System.out.println("user press Logout button");
			}
		});
		this.setVisible(true);
		
		btnHelp = new JButton("Help");
		btnHelp.setBounds(390, 11, 80, 19);
		btnHelp.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				  HelpWin help = new HelpWin ("Choose an Assignment to see your grade and teacher comments");
				  System.out.println("user press Help button");
			}
		});
		this.add(btnHelp,null);
	}
	

}
